/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CareerService.Entitybeans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "employer")
@NamedQueries({@NamedQuery(name = "Employer.findAll", query = "SELECT e FROM Employer e"), @NamedQuery(name = "Employer.findByEmnum", query = "SELECT e FROM Employer e WHERE e.emnum = :emnum"), @NamedQuery(name = "Employer.findByCname", query = "SELECT e FROM Employer e WHERE e.cname = :cname"), @NamedQuery(name = "Employer.findByLocation", query = "SELECT e FROM Employer e WHERE e.location = :location"), @NamedQuery(name = "Employer.findByPhone", query = "SELECT e FROM Employer e WHERE e.phone = :phone"), @NamedQuery(name = "Employer.findByEmail", query = "SELECT e FROM Employer e WHERE e.email = :email")})
public class Employer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "emnum")
    private Integer emnum;
    @Basic(optional = false)
    @Column(name = "cname")
    private String cname;
    @Column(name = "location")
    private String location;
    @Basic(optional = false)
    @Column(name = "phone")
    private String phone;
    @Basic(optional = false)
    @Column(name = "email")
    private String email;
    @Lob
    @Column(name = "description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "emnum")
    private Collection<Jobs> jobsCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "emnum")
    private Collection<Cvdownlist> cvdownlistCollection;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private Users userId;
    @JoinColumn(name = "country", referencedColumnName = "country_id")
    @ManyToOne
    private Countries country;
    @JoinColumn(name = "town", referencedColumnName = "town_id")
    @ManyToOne
    private Towns town;
    @JoinColumn(name = "com_type", referencedColumnName = "type_id")
    @ManyToOne
    private CompanyType comType;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "emnum")
    private Collection<Interview> interviewCollection;

    public Employer() {
    }

    public Employer(Integer emnum) {
        this.emnum = emnum;
    }

    public Employer(Integer emnum, String cname, String phone, String email) {
        this.emnum = emnum;
        this.cname = cname;
        this.phone = phone;
        this.email = email;
    }

    public Integer getEmnum() {
        return emnum;
    }

    public void setEmnum(Integer emnum) {
        this.emnum = emnum;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Collection<Jobs> getJobsCollection() {
        return jobsCollection;
    }

    public void setJobsCollection(Collection<Jobs> jobsCollection) {
        this.jobsCollection = jobsCollection;
    }

    public Collection<Cvdownlist> getCvdownlistCollection() {
        return cvdownlistCollection;
    }

    public void setCvdownlistCollection(Collection<Cvdownlist> cvdownlistCollection) {
        this.cvdownlistCollection = cvdownlistCollection;
    }

    public Users getUserId() {
        return userId;
    }

    public void setUserId(Users userId) {
        this.userId = userId;
    }

    public Countries getCountry() {
        return country;
    }

    public void setCountry(Countries country) {
        this.country = country;
    }

    public Towns getTown() {
        return town;
    }

    public void setTown(Towns town) {
        this.town = town;
    }

    public CompanyType getComType() {
        return comType;
    }

    public void setComType(CompanyType comType) {
        this.comType = comType;
    }

    public Collection<Interview> getInterviewCollection() {
        return interviewCollection;
    }

    public void setInterviewCollection(Collection<Interview> interviewCollection) {
        this.interviewCollection = interviewCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (emnum != null ? emnum.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employer)) {
            return false;
        }
        Employer other = (Employer) object;
        if ((this.emnum == null && other.emnum != null) || (this.emnum != null && !this.emnum.equals(other.emnum))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "CareerService.Entitybeans.Employer[emnum=" + emnum + "]";
    }

}
